package com.yl.module.property.domain;


import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import lombok.Getter;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 资产类型表 实体
 * @author makejava
 * @date 2024-10-23 15:54:16
 */
@Data
@Accessors(chain = true)
@TableName("property_type")
@ApiModel(value = "PropertyType", description = "资产类型表")
public class PropertyType extends Model<PropertyType> implements Serializable {
	private static final long serialVersionUID = 302196679160291875L;

    @ApiModelProperty(value = "资产类型表-主键id")
	@TableId(value = "id", type = IdType.AUTO)
    private Integer id;

	@ApiModelProperty(value = "三方资产类型唯一标识 例如华为的设备类型唯一标识")
	@TableField("`tripartite_property_type_id`")
    private String tripartitePropertyTypeId;

	@ApiModelProperty(value = "父类id 如果是根节点 父类id就是0")
	@TableField("`parent_id`")
    private Integer parentId;

	@ApiModelProperty(value = "父类id集字符串 不包含当前节点id 通过逗号分隔 例如1,2,3")
	@TableField("`parent_ids`")
	private String parentIds;

	@ApiModelProperty(value = "名称")
	@TableField("`name`")
    private String name;

	@ApiModelProperty(value = "父类id集字符串 包含当前节点id 通过逗号分隔 例如1,2,3 目前只用于初始化数据使用")
	@TableField("`parent_ids_import`")
	private String parentIdsImport;

	@ApiModelProperty(value = "父类名称集 包含当前节点名称 通过逗号分隔 例如家电,IT影音电器 目前只用于初始化数据使用")
	@TableField("`parent_names_import`")
	private String parentNamesImport;

	@ApiModelProperty(value = "颜色码")
	@TableField("`color_code`")
	private String colorCode;

	@ApiModelProperty(value = "备注")
	@TableField("`remark`")
    private String remark;

	@ApiModelProperty(value = "是否开启保养提醒 0否 1是 默认0")
	@TableField("`is_maintain`")
	private Integer isMaintain;

	@ApiModelProperty(value = "保养周期(月)")
	@TableField("`maintain_period`")
	private Integer maintainPeriod;

	@ApiModelProperty(value = "下次保养日期")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@TableField("`next_time_maintain`")
	private LocalDateTime nextTimeMaintain;

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@TableField("`create_time`")
    private LocalDateTime createTime;

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@TableField("`update_time`")
    private LocalDateTime updateTime;

	@TableField("`delete_flag`")
    private Integer deleteFlag;


	@Getter
	public enum IdEnum{
		ID_1(1,"家电"),
		ID_2(2,"安消"),
		ID_3(3,"家具"),
		ID_4(4,"构件");

		private final Integer code;
		private final String name;

		IdEnum(Integer code ,String name ){
			this.code = code;
			this.name = name;
		}

		public static Map<Integer, IdEnum> map = Stream.of(values())
				.collect(Collectors.toMap(IdEnum::getCode, Function.identity(), (r1, r2) -> r1));

		public static Set<Integer> getCodes() {
			Set<Integer> codes = map.keySet();
			return codes;
		}
	}








}

